#!/bin/bash

cpu=$(echo "100.0-$(top -bn1|grep Cpu|awk -F'[ ,]+' '{print $8}')"|bc)"%"
#cpu1=$(top -bn1|grep Cpu|awk -F'[ ,]+' '{print $8}')"%"
mem=$(free -m | grep Mem | awk '{ printf "%.2f%%\n", ($3/$2)*100 }')

echo "cpu占用率$cpu,内存占用率$mem" >>/root/monitor_txt

